/*
 * @Descripttion: 
 * @version: 
 * @Author: sueRimn
 * @Date: 2021-03-18 00:19:30
 * @LastEditors: sueRimn
 * @LastEditTime: 2021-03-18 00:50:33
 */
/*
  将下面异步代码使用 Promise 的方法改进
  尽量用看上去像同步代码的方式
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c = 'I ♥ U'
        console.log(a + b +c)
      }, 10)
    }, 10)
  }, 10)
*/

const promise = (str) => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(str)
    }, 10)
  })
}

const logFn = async () => {
  var a = await promise('hello')
  var b = await promise('lagou')
  var c = await promise('I ♥ U')
  console.log( `${a} ${b} ${c}`);
}

console.log(logFn())